home *** CD-ROM | disk | FTP | other *** search
- // Chap16_1.cpp
- #include <iostream.h>
- #include <string.h>
- class Student
- {
- public:
- static int number()
- {
- return noOfStudents;
- }
- //...other stuff the same...
- protected:
- char name[40];
- static int noOfStudents;
- };
- int Student::noOfStudents = 0;
- int main()
- {
- Student s;
- cout << s.number() << "\n";
- cout << Student::number() << "\n";
- return 0;
- }
-
-